import { defineStore } from "pinia";

export const useOrderStore = defineStore("orderStore",{
    state:()=>({
        hotelImage: "",
        hotelName: "",
        hotelAddress: "",
        hotelPhone: "",
        roomImage: "",
        roomName: "",
        roomDesc: "",
        roomArea: "",
        roomPrice: "",
        userName: "",
        userPhone: "",
        checkIn: "",
        checkOut: "",
    }),
    actions:{
        setOrder(data:any) {
            this.hotelImage = data.hotelImage || "";
            this.hotelName = data.hotelName || "";
            this.hotelAddress = data.hotelAddress || "";
            this.hotelPhone = data.hotelPhone || "";
            this.roomImage = data.roomImage || "";
            this.roomName = data.roomtypeName || data.roomName || "";
            this.roomDesc = data.roomtypeDes || data.roomDesc || "";
            this.roomArea = data.roomArea || "";
            this.roomPrice = data.roomtypePrice || data.roomPrice || "";
            this.userName = data.userName || "";
            this.userPhone = data.userPhone || "";
            this.checkIn = data.checkIn || "";
            this.checkOut = data.checkOut || "";
        }
    },
    persist: true, // 开启持久化
})